// https://iai.sh.cn/problem/928
#include <bits/stdc++.h>
using namespace std;
int res[10000000];
int main() {
  string a, b;
  cin >> a >> b;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  int len = max(a.size(), b.size());
  int ans = 0;
  for (int i = 0; i < len; i++) {
    int digit_a = i < a.size() ? a[i] - '0' : 0;
    int digit_b = i < b.size() ? b[i] - '0' : 0;
    res[i] += digit_a + digit_b;
    if (res[i] >= 10) {
      ans++;
      res[i] -= 10;
      res[i + 1]++;
    }
  }
  cout << ans;
  return 0;
}